Repository navigation
feat(pm-stack): scheduled-history collector — per-run history for OpenChamber scheduled tasks (#2174 Gap 1) - #8437
Conversation
…nChamber scheduled tasks (#2174 Gap 1)
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 58 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 044d40f77a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if lookup is not None and row.get("tokens") is None and row.get("session_id"): | ||
| got = lookup(row["session_id"]) | ||
| if got: | ||
| row.update(got) |
There was a problem hiding this comment.
Refresh usage while the session is still accumulating tokens
When the first poll finds a session that is still running, this condition permanently freezes its current token counts, cost, and session_updated_at: every later poll skips the lookup because tokens is already non-null. This also affects sessions that outlive the scheduler’s terminal transition, explicitly acknowledged in the README, so long-running tasks can retain zero or partial usage indefinitely and corrupt the comparison/watchdog dataset. Refresh session enrichment on subsequent polls independently of the scheduler outcome.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 3ffc41c (task 17227 shepherd pass) — see the merge-ready note on this PR for the per-finding disposition and the new regression checks in test_collect.py (19/19 pass).
| Description=Run the scheduled-task history collector every 5 minutes — code#2174 Gap 1 | ||
|
|
||
| [Timer] | ||
| OnCalendar=*:0/5 |
There was a problem hiding this comment.
Register the collector timer in the fleet schedule registry
This introduces a recurring laptop systemd schedule, but doc/fleet-schedule-registry.md has no entry for scheduled-history.timer, and this commit does not update the registry. Because the registry supplies the fleet placement audit’s inventory, this collector’s recurring work will be invisible to that review. Add its registry row in the same change, as required for new laptop timers.
AGENTS.md reference: AGENTS.md:L53-L58
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 3ffc41c (task 17227 shepherd pass) — see the merge-ready note on this PR for the per-finding disposition and the new regression checks in test_collect.py (19/19 pass).
| if args.since and started < args.since: | ||
| continue | ||
| if args.until and started > args.until: |
There was a problem hiding this comment.
Compare parsed timestamps when filtering run history
When --since or --until uses an ISO timestamp with Z or a non-UTC offset, these string comparisons can include or exclude the wrong runs because stored timestamps always use +00:00. For example, a run starting at 2026-11-11T12:30:00+00:00 is excluded by --since 2026-11-11T13:00:00+01:00, even though that bound means 12:00 UTC. Parse and normalize both bounds and stored timestamps before comparing them so the documented inclusive time window operates on instants rather than their textual representations.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 3ffc41c (task 17227 shepherd pass) — see the merge-ready note on this PR for the per-finding disposition and the new regression checks in test_collect.py (19/19 pass).
| os.makedirs(os.path.dirname(path), exist_ok=True) | ||
| doc = {"schema": "scheduled-history/v1", "rows": rows} | ||
| fd, tmp = tempfile.mkstemp(dir=os.path.dirname(path), suffix=".tmp") |
There was a problem hiding this comment.
Resolve bare store filenames before creating their directory
When the collector is invoked with a bare relative store filename, such as --store history.json collect --dir /project, os.path.dirname(path) returns an empty string and os.makedirs('') raises FileNotFoundError. Consequently this --store override never saves any collected history, even though the same path works with list. Normalize the store path or resolve its parent to . consistently for both directory creation and temporary-file placement.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 3ffc41c (task 17227 shepherd pass) — see the merge-ready note on this PR for the per-finding disposition and the new regression checks in test_collect.py (19/19 pass).
|
agent-note:v1 |
…--until, bare store filename, registry row (Codex P1/P2 on #8437)
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
agent-note:v1
|
Refs #2174 (Gap 1 of the evidence gaps; Gap 3 named as the follow-on on the issue).
Builds the per-run history consumer for OpenChamber scheduled tasks in pm-stack/scheduled-history/:
openchamber schedule list --jsonand reconciles runs keyed by (task id, lastScheduledFor): exactly one durable row per run; outcome follows the record until terminal, then the row freezes; a newer run finalizes an older non-terminal row as superseded.collect.py list [--task] [--since] [--until] [--json]— the input the OpenCode scheduled tasks: migrate the Muse→OpenCode cron wrappers into OpenChamber scheduled tasks (waves, monitoring gates) #2174 comparison and the Gap 3 watchdog will consume.Live verification (2026-11-11): first tick inserted 24 rows (one per code-project scheduled task's latest run), every row token-enriched (e.g. one run: input 1,199,142 / output 6,470 tokens, cost 0.192); second tick inserted 0 (idempotent). Tests: test_collect.py 13/13 (insert, dedupe, running→error transition, supersede-finalize, token enrichment present/absent, never-ran, store round-trip).
Queue: task 12585, lane code-v (resumed prior handoff branch queue/12585-2174-run-history).
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.